<?php
/**
 * Mechanism
 * 
 * LICENSE
 * 
 * This file is private intellectual property of the author. 
 * All rights reserved. Copying and illegal using is punishable by law.
 * 
 * @copyright Copyright (c) 2011 BreatheInMyVoid ( BreatheInMyVoid@gmail.com )
 */

namespace Mechanism\Request {
	abstract class Request implements IRequest {
		/**
		 * Extern variables namespace
		 *
		 * @see get_var( )
		 * @see set_var( )
		 * $var string 
		 */
		protected $var_namespace = '__g83pq826bNbsiLar92017mNnSsh8fxlA__';

		/**
		 *
		 */
		public function get_var( $key = null, $defaut = null ) {
 			return ( isset( $_REQUEST[$this->var_namespace][$key] ) ) ? 
 				$_REQUEST[$this->var_namespace][$key] : $default;
		}

		/**
		 *
		 */
		public function set_var( $key, $value ) {
			/* Prevent conflicts */
			if ( isset( $_REQUEST[$this->var_namespace] ) && 
				 !is_array( $_REQUEST[$this->var_namespace] ) ) {
				$_REQUEST[$this->var_namespace] = array( );
			}

			$_REQUEST[$this->var_namespace][$key] = $value;
		}
	}
}
